package main


/**
*
*
文档
https://gin-gonic.com/zh-cn/docs/

go env -w GO111MODULE=on 
go env -w GOPROXY=https://goproxy.cn,direct

go mod init mygin
go get -u github.com/gin-gonic/gin
go run httpGin.go

测试访问
curl http://192.168.110.94:8888/ping
*/

import (
  "net/http"

  "github.com/gin-gonic/gin"
)

func main() {
  r := gin.Default()
  r.GET("/ping", func(c *gin.Context) {
    c.JSON(http.StatusOK, gin.H{
      "message": "pong",
    })
  })
  r.Run(":8888") // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
}